package com.wizz.trade.template.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wizz.trade.template.entity.PCDetails;
import com.wizz.trade.template.mapper.PCDetailsMapper;
import com.wizz.trade.template.service.PCDetailsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author fyftless
 * @since 2023-04-19 08:04:10
 */
@Service
public class PCDetailsServiceImpl extends ServiceImpl<PCDetailsMapper, PCDetails> implements PCDetailsService {

    @Resource
    private PCDetailsMapper pcDetailsMapper;

    @Override
    public void insert(PCDetails PCDetails) {
        pcDetailsMapper.insert(PCDetails);
    }

    @Override
    public void update(PCDetails PCDetails) {
        pcDetailsMapper.updateById(PCDetails);
    }

    @Override
    public void delete(Integer id) {
        pcDetailsMapper.deleteById(id);
    }

    @Override
    public List<PCDetails> getAll(Integer id) {
        LambdaQueryWrapper<PCDetails> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(PCDetails::getInfoId, id);
        return pcDetailsMapper.selectList(queryWrapper);
    }
}
